********************************************************************************
/** Data for replication package **

Paper Title: Drivers of firm-government engagement for technology ventures

Authors: Lauren Lanahan; Iman Hemmatian; Amol M. Joshi; Evan E. Johnson

Lead Author of Data Curation & Code/Analysis: Lauren Lanahan (llanahan@uoregon.edu)

Software: Stata 18; Tableau

Computational Requirements: We utilized a powerful server (32-core processors, 384 GB memory, 32 TB storage) to construct the sample and run the analyses. We provide the code and data for all assessments. And for additional transparency, we provide the log file for the set of empirical assessments (i.e., descriptive statistics and regression assessments). 

Replication package includes:

[1] do file
	Do File_READ FIRST.do

[3] dta files
	Descriptive Statistics Data File.dta (Table 4, Table 5; S1 Table; S3 Table; )
	Regression Data File.dta (Table 6; S2 Table; S4 Table; S5 Table; S6 Table; Table 7; Table 8)
	Data for Tableau (Figure 2)

[1] log file
	Replication Log.smcl
		
Comment: Code is organized in manner that reflects ordering of the empirical results presented in paper. Note, we report the raw data for Table 1 in the table itself.
**/

global dir // set directory manually
********************************************************************************
********************************************************************************
*log using "D:\CORE\DATA\NETS SEAT LICENSE_LANAHAN\SAM ENTRY\Dataverse\Replication Log.smcl", replace 
********************************************************************************
********************************************************************************
* TABLES 4 & 5: Descriptive Statistics
clear all
set more off
use "$dir\Descriptive Statistics Data File.dta"
{
global DS entry_sam_yr3 yr_1 yr_2 yr_3 URM WOMAN MINORITY size any_CREDIT SIZE_w SALES_w_100k II_50 CI_50 SP II_CI CI_SP II_SP II_CI_SP PTAC CDFI dist_carnegie_research_w dist_ptac_w dist_ACCELERATOR_w dist_fdic_w dist_cdfi_w dist_ANGEL_aggregate_w dist_VC_aggregate_w HHIndex_1 HHIndex_2 HHIndex_3 startup_ratio POLITICAL_ALIGNMENT DEM st_a st_b st_c st_d st_e DE n4_1 n4_2 n4_3 n4_4 n4_5 n4_6 n4_7 n4_8 n4_9 n4_10 any_patent_3yr anyst_TBED FPDS
estpost tabstat $DS, statistics(count mean p50 p25 p75 sd min max) columns(statistics)
	set more off
	matrix m1=(1)
	matrix m2=(1)
	matrix m3=(1)
	matrix m4=(1)
	foreach x in $DS {
	quietly ttest `x', by(entry_sam_yr3) unequal
	matrix m1 = m1\(r(mu_1))
	matrix m2 = m2\(r(mu_2))
	matrix m3 = m3\(r(t))
	matrix m4 = m4\(r(p))
	}
	matrix q1 = (m1[2..53,1..1],m2[2..53,1..1],m3[2..53,1..1],m4[2..53,1..1])
	matrix colnames q1 = CONTROL SAM t-stat p-value
	matrix rownames q1 = entry_sam_yr3 yr_1 yr_2 yr_3 URM WOMAN MINORITY size any_CREDIT SIZE_w SALES_w_100k II_50 CI_50 SP II_CI CI_SP II_SP II_CI_SP PTAC CDFI dist_carnegie_research_w dist_ptac_w dist_ACCELERATOR_w dist_fdic_w dist_cdfi_w dist_ANGEL_aggregate_w dist_VC_aggregate_w HHIndex_1 HHIndex_2 HHIndex_3 startup_ratio POLITICAL_ALIGNMENT DEM st_a st_b st_c st_d st_e DE n4_1 n4_2 n4_3 n4_4 n4_5 n4_6 n4_7 n4_8 n4_9 n4_10 any_patent_3yr anyst_TBED FPDS
	matrix drop m1 m2 m3 m4
	mat list q1
}

* S1 Table: Correlation Matrix
clear all
set more off
use "$dir\Descriptive Statistics Data File.dta"
{
* Panel A
global internal URM WOMAN MINORITY size any_CREDIT any_patent_3yr
global external II_50 CI_50 SP II_CI CI_SP II_SP II_CI_SP POLITICAL_ALIGNMENT DEM PTAC CDFI  
correlate entry_sam_yr3 $internal $external

*Panel B
global external dist_carnegie_research_w dist_ptac_w dist_ACCELERATOR_w dist_fdic_w dist_cdfi_w dist_ANGEL_aggregate_w dist_VC_aggregate_w  HHI_dum startup_ratio POLITICAL_ALIGNMENT DEM 
correlate entry_sam_yr3 $internal $external
}

* TABLE 6: Logit
clear all
set more off
use "$dir\Regression Data File.dta"
{
set more off
global internal URM WOMAN MINORITY size any_CREDIT any_patent_3yr
global external II_50 CI_50 SP II_CI CI_SP II_SP II_CI_SP POLITICAL_ALIGNMENT DEM PTAC CDFI 
global st st_1 st_2 st_3 st_4 st_5 st_6 st_7 st_8 st_9 st_10 st_11 st_12 st_13 st_14 st_15 st_16 st_17 st_18 st_19 st_20 st_21 st_22 st_23 st_24 st_25 st_26 st_27 st_28 st_29 st_30 st_31 st_32 st_33 st_34 st_35 st_36 st_37 st_38 st_39 st_40 st_41 st_42 st_43 st_44 st_45 st_46 st_47 st_48 st_49 st_50 st_51 st_52 st_53 
global regressors entry_sam_yr* firstyear n4_imprint
keep $internal $external $st $regressors
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal, robust
margins, dydx(*) post
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $external, robust
margins, dydx(*) post
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external, robust
margins, dydx(*) post
}

* S2 TABLE: Timing Extension
clear all
set more off
use "$dir\Regression Data File.dta"
{
global internal URM WOMAN MINORITY size any_CREDIT any_patent_3yr
global external II_50 CI_50 SP II_CI CI_SP II_SP II_CI_SP POLITICAL_ALIGNMENT DEM PTAC CDFI 
global st st_1 st_2 st_3 st_4 st_5 st_6 st_7 st_8 st_9 st_10 st_11 st_12 st_13 st_14 st_15 st_16 st_17 st_18 st_19 st_20 st_21 st_22 st_23 st_24 st_25 st_26 st_27 st_28 st_29 st_30 st_31 st_32 st_33 st_34 st_35 st_36 st_37 st_38 st_39 st_40 st_41 st_42 st_43 st_44 st_45 st_46 st_47 st_48 st_49 st_50 st_51 st_52 st_53 
global regressors entry_sam_yr* firstyear n4_imprint last_firm_year
keep $internal $external $st $regressors
set more off
logit entry_sam_yr4 $st i.firstyear i.n4_imprint $internal $external if last_firm_year > 3, robust
margins, dydx(*) post
logit entry_sam_yr5 $st i.firstyear i.n4_imprint $internal $external if last_firm_year > 4, robust
margins, dydx(*) post
} 

* S3 TABLE: Descriptive Statistics Extensions for Ecosystem Indicators 
clear all
set more off
use "$dir\Descriptive Statistics Data File.dta"
{
global q II_Q1 CI_Q1 SP_Q1 II_CI_Q1 II_SP_Q1 CI_SP_Q1 II_CI_SP_Q1 PTAC_Q1 CDFI_Q1 II_Q4 CI_Q4 SP_Q4 II_CI_Q4 II_SP_Q4 CI_SP_Q4 II_CI_SP_Q4 PTAC_Q4 CDFI_Q4 urm_venture_ratio URM_embedded sam_venture_ratio_w SAM_embedded
estpost tabstat $q, statistics(count mean p50 p25 p75 sd min max) columns(statistics)
	set more off
	matrix m1=(1)
	matrix m2=(1)
	matrix m3=(1)
	matrix m4=(1)
	foreach x in $q {
	quietly ttest `x', by(entry_sam_yr3) unequal
	matrix m1 = m1\(r(mu_1))
	matrix m2 = m2\(r(mu_2))
	matrix m3 = m3\(r(t))
	matrix m4 = m4\(r(p))
	}
	matrix q1 = (m1[2..23,1..1],m2[2..23,1..1],m3[2..23,1..1],m4[2..23,1..1])
	matrix colnames q1 = CONTROL SAM t-stat p-value
	matrix rownames q1 = II_Q1 CI_Q1 SP_Q1 II_CI_Q1 II_SP_Q1 CI_SP_Q1 II_CI_SP_Q1 PTAC_Q1 CDFI_Q1 II_Q4 CI_Q4 SP_Q4 II_CI_Q4 II_SP_Q4 CI_SP_Q4 II_CI_SP_Q4 PTAC_Q4 CDFI_Q4 urm_venture_ratio URM_embedded sam_venture_ratio_w SAM_embedded
	matrix drop m1 m2 m3 m4
	mat list q1
}

* S4 TABLE: Sensivity Check of Ecosystem Indicators 
clear all
set more off
use "$dir\Regression Data File.dta"
{
set more off
global internal URM WOMAN MINORITY size any_CREDIT any_patent_3yr
global external II_Q1 CI_Q1 SP_Q1 II_CI_Q1 CI_SP_Q1 II_SP_Q1 II_CI_SP_Q1 POLITICAL_ALIGNMENT DEM PTAC_Q1 CDFI_Q1 // leading quartile
global st st_1 st_2 st_3 st_4 st_5 st_6 st_7 st_8 st_9 st_10 st_11 st_12 st_13 st_14 st_15 st_16 st_17 st_18 st_19 st_20 st_21 st_22 st_23 st_24 st_25 st_26 st_27 st_28 st_29 st_30 st_31 st_32 st_33 st_34 st_35 st_36 st_37 st_38 st_39 st_40 st_41 st_42 st_43 st_44 st_45 st_46 st_47 st_48 st_49 st_50 st_51 st_52 st_53 
global externalb II_Q4 CI_Q4 SP_Q4 II_CI_Q4 CI_SP_Q4 II_SP_Q4 II_CI_SP_Q4 POLITICAL_ALIGNMENT DEM PTAC_Q4 CDFI_Q4 // lagging quartile
global regressors entry_sam_yr* firstyear n4_imprint
keep $internal $external $externalb $st $regressors
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external, robust
margins, dydx(*) post
global external II_Q4 CI_Q4 SP_Q4 II_CI_Q4 CI_SP_Q4 II_SP_Q4 II_CI_SP_Q4 POLITICAL_ALIGNMENT DEM PTAC_Q4 CDFI_Q4 // lagging quartile
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external, robust
margins, dydx(*) post
}

* S5 TABLE: Senstivity Check (individual regressors)
clear all
set more off
use "$dir\Regression Data File.dta"
{
global internal URM WOMAN MINORITY SIZE_w_ihs any_CREDIT any_patent_3yr 
global external dist_carnegie_research_w_ihs dist_ACCELERATOR_w_ihs dist_fdic_w_ihs dist_ANGEL_aggregate_w_ihs dist_VC_aggregate_w_ihs HHI_dum startup_ratio POLITICAL_ALIGNMENT DEM dist_ptac_w_ihs dist_cdfi_w_ihs
global regressors entry_sam_yr* firstyear n4_imprint
keep $internal $external $st $regressors
set more off
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal, robust
margins, dydx(*) post
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $external, robust
margins, dydx(*) post
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external, robust
margins, dydx(*) post
}

* S6 TABLE: Fixed Effect and Regressor Extensions
clear all
set more off
use "$dir\Regression Data File.dta"
{
global internal URM WOMAN MINORITY size any_CREDIT any_patent_3yr
global external II_50 CI_50 SP II_CI CI_SP II_SP II_CI_SP POLITICAL_ALIGNMENT DEM PTAC CDFI 
gen trump = 1 if firstyear == 2017
recode trump (.=0)
global regressors entry_sam_yr* firstyear n4_imprint last_firm_year FPDS anyst_TBED trump
keep $internal $external $regressors
set more off
logit entry_sam_yr3 $internal $external FPDS anyst_TBED trump, robust
margins, dydx(*) post
} 

* TABLES 7 & 8: Heterogeneity Analysis
clear all
set more off
use "$dir\Regression Data File.dta"
{
global internal URM WOMAN MINORITY size any_CREDIT any_patent_3yr
global external II_50 CI_50 SP II_CI CI_SP II_SP II_CI_SP POLITICAL_ALIGNMENT DEM PTAC CDFI 
global st st_1 st_2 st_3 st_4 st_5 st_6 st_7 st_8 st_9 st_10 st_11 st_12 st_13 st_14 st_15 st_16 st_17 st_18 st_19 st_20 st_21 st_22 st_23 st_24 st_25 st_26 st_27 st_28 st_29 st_30 st_31 st_32 st_33 st_34 st_35 st_36 st_37 st_38 st_39 st_40 st_41 st_42 st_43 st_44 st_45 st_46 st_47 st_48 st_49 st_50 st_51 st_52 st_53 
global regressors entry_sam_yr* firstyear n4_imprint URM_embedded SAM_embedded anyst_TBED FPDS firstyear SM_biz
keep $internal $external $st $regressors
preserve
keep if URM == 0
set more off
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external URM_embedded SAM_embedded, robust
margins, dydx(*) post
restore 
preserve 
keep if URM == 1
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external URM_embedded SAM_embedded, robust
margins, dydx(*) post
restore 
preserve 
keep if WOMAN == 1
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external URM_embedded SAM_embedded, robust
margins, dydx(*) post
restore 
preserve 
keep if MINORITY == 1
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external URM_embedded SAM_embedded, robust
margins, dydx(*) post
restore 
preserve 
keep if anyst_TBED == 1
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external, robust // SSTI
margins, dydx(*) post
restore 
preserve 
keep if FPDS == 1
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external, robust // FPDS
margins, dydx(*) post
restore 
preserve 
keep if firstyear > 2016
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external, robust // TRUMP
margins, dydx(*) post
restore 
preserve
keep if SM_biz == 1
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external URM_embedded SAM_embedded, robust // SMALL
margins, dydx(*) post
restore 
preserve 
keep if SM_biz == 0
logit entry_sam_yr3 $st i.firstyear i.n4_imprint $internal $external URM_embedded SAM_embedded, robust // MEDIUM
margins, dydx(*) post
restore   
}
log close
********************************************************************************
********************************************************************************